package com.yonyou.pmclouds.repeatwork.process;

import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.repeatwork.entity.RepeatWorkVO;

/**
 * 校验前端必输项
 */
public class RepeatWorkInsertCheckProcessor implements SingleProcessor<RepeatWorkVO> {
    @Override
    public void process(RepeatWorkVO vo, RepeatWorkVO orig) throws BusinessException {
        if (null == vo) {
            throw new BusinessException("单据不能为空！");
        }
        if (null == vo.getRepeatDate()) {
            throw new BusinessException("复工日期不能为空！");
        }
        if (null == vo.getRepeatReason() || "".equals(vo.getRepeatReason().trim())) {
            throw new BusinessException("复工说明不能为空！");
        }
        if (vo.getRepeatReason().length()>300){
            throw  new BusinessException("复工说明最多只能有300个字！");
        }
    }
}
